#pragma once
#ifndef SOLUTION_H
#define SOLUTION_H

#include <string>
#include "Global.h"
#include "Object.h"
#include <vector>
#include <random>
#include <cmath>
#include <algorithm>
#include <set>
#include <omp.h>
struct Proposal {
    Instance* inst;
    int new_x;
    int new_y;
    double delta_cost;
};

class Solution
{
public:
    void placementAnnealing();
    void initializePlacement();
    void randomPlacement();
    void moveInstance(Instance* inst, int new_x, int new_y);
    double calculateTotalHPWL();
    double calculateCost();
    bool isLegalPlacement();
private:
    double calculateDeltaCost(Instance* inst, int new_x, int new_y);
    double initialTemperature = 1000.0;
    double coolingRate = 0.95;
    int movesPerTemp = 1000;
    std::mt19937 gen;
    int num_threads_ = 4;
};

int readBenchMarkFile(std::string i_file_name);

int outputSolution(std::string i_file_name);
// 报告当前布局的布线长度，使用HPWL线长预估模型
int reportWireLength();
// 报告当前布局是否合法
int reportValid();

#endif